
<link href="/statics/plugins/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" />
<script type="text/javascript" src="/statics/plugins/fancybox/jquery.fancybox-1.3.4.pack.js"></script>

<div class="box box-solid">

    <div class="box-header">
        <div class="box-tools">
            <form name="filter" action="#" method="get">
                <div class="input-group long-group">
                    <label class="pull-left">
                        关键词搜索:
                        <input type="text" class="form-control input-sm " name="keyword" style="width:120px;" value="<?php if(!empty($search['keyword'])){echo $search['keyword'];} ?>"/>
                    </label>
                    <label class="pull-left">
                        <select name="day"  class="form-control input-sm " style="width:120px;">
                            <option value=''>请选择日期</option>
                            <?php for($i = 1;$i<=31;$i++) {
                               if(!empty($search['day']) && $search['day'] == $i){
                                    echo "
                                        <option selected='selected' value='".$i."'>".$i."</option>
                                    ";
                                }else {
                                    echo "
                                        <option value='".$i."'>".$i."</option>
                                    ";
                                }
                            } ?>
                        </select>
                    </label>

                    <label class="pull-left">
                        请选择日期:
                        <select name="month"  class="form-control input-sm " style="width:120px;">
                            <option value=''>请选择月份</option>
                            <?php for($i = 1;$i<=12;$i++) {
                               if(!empty($search['month']) && $search['month'] == $i){
                                    echo "
                                        <option selected='selected' value='".$i."'>".$i."</option>
                                    ";
                                }else {
                                    echo "
                                        <option value='".$i."'>".$i."</option>
                                    ";
                                }
                            } ?>
                        </select>
                    </label>
                    <label class="pull-left">
                        <select name="year" class="form-control input-sm" style="width:120px;">
                            <option value=''>请选择年份</option>
                            <?php for($i = date('Y',time());$i>=2016;$i--) {
                                if(!empty($search['year']) && $search['year'] == $i){
                                    echo "
                                        <option selected='selected' value='".$i."'>".$i."</option>
                                    ";
                                }else {
                                    echo "
                                        <option value='".$i."'>".$i."</option>
                                    ";
                                }
                            } ?>
                        </select>
                    </label>
                <label class="pull-left" >
                        请选择管理员:
                        <select name='u_id' class="form-control input-sm" style="width:120px;" >
                            <option value="">请选择</option>
                            <?php if(!empty($managers)): ?>
                                <?php foreach ($managers as $key => $value) :?>
                                    <option <?php if(!empty($search['u_id']) && $search['u_id'] == $value['id']) echo 'selected="selected"' ?> value='<?php echo $value['id'] ?>'><?php echo $value['name'] ?></option>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </select>
                    </label>
                <label class="pull-left" style='margin-right:8px;'>
                        请选择模块:
                        <select name='module_id' class="form-control input-sm" style="width:120px;" >
                            <option value="">请选择</option>
                            <?php if(!empty($modules)): ?>
                                <?php foreach ($modules as $key => $value) :?>
                                    <option <?php if(!empty($search['module_id']) && $search['module_id'] == $key) echo 'selected="selected"' ?> value='<?php echo $key ?>'><?php echo $value ?></option>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </select>
                    </label>
                    <div class="input-group-btn pull-left search_btn">
                        <button type="submit" class="btn btn-sm btn-primary" >搜索<!-- <i class="fa fa-search"></i> --></button>
                        <a href='<?php echo $this->createUrl("option/index") ?>' class="btn btn-sm btn-default"  >清空条件</a>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="box-body table-responsive">
        <table class="table table-hover table-bordered">
            <tr>
                <th style='text-align:center'>编号</th>
                <th style='text-align:center'>操作人员</th>
                <!-- <th style='text-align:center'>操作类型</th> -->
                <th style='text-align:center'>操作内容</th>
                <th style='text-align:center'>日期</th>
                <th style='width:200px;max-height:100px;text-align:center'>数据</th>
            </tr>
    <?php if (!empty($result['data'])) : ?>
    <?php foreach ($result['data'] as $data) : ?>
        <tr>
            <td style='text-align:center'><?php echo $data['id']; ?></td>
            <td style='text-align:center'><?php echo $data['user_name']; ?></td>
            <!-- <td style='text-align:center'>
            <?php
                if($data['type'] == OptionLog::OPTION_TYPE_ADD) echo '添加';
                if($data['type'] == OptionLog::OPTION_TYPE_UPDATE) echo '修改';
                if($data['type'] == OptionLog::OPTION_TYPE_DELETED) echo '删除';
            ?>
            </td> -->
            <td style='text-align:center'><?php echo $data['log_msg']; ?></td>
            <td style='text-align:center'><?php echo date('Y-m-d H:i:s',$data['ctime']); ?></td>
            <td  style='width:200px;max-height:100px;' class="align-center tool-bar">
            <!-- <a href='#show_data' class='show'>点此查看数据变动</a> -->
            <a href="/admin/option/detail/id/<?php echo $data['id'] ?>" target='_blank'>数据变动详情</a>
            <div style='display:none' class='data_div'>

            </div>
            </td>
        </tr>
     <?php endforeach; ?>
    <?php endif; ?>
        </table>
    </div>
    <div class="box-footer clearfix">
    <?php if(!empty($result['data'])): ?>
        <?php $this->widget('BLinkPager', array('pages'=>$result['pages'])); ?>
    <?php endif; ?>
    </div>
</div>

<div style='display:none;'>
    <div id='show_data'>

    </div>
</div>
<style type="text/css">
    #show_data{
        width: 500px;
        padding: 20px;
        font-size: 9px;
    }
    #show_data span{
        color: #e00;
        margin-right: 5px;
    }
</style>
<script type="text/javascript">
    $(function(){
        $('.show').mouseover(function(){
            $('#show_data').empty();
            $('#show_data').append($(this).parent().find('.data_div').html());
        });

        $(".show").fancybox({
            'padding':0,
            'overlayShow':true,
            'overlayOpacity':0.6,
            'hideOnOverlayClick':false,
            'showCloseButton':false,
            'hideOnOverlayClick':true
        });
    });
</script>
